<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>async的基本操作</title>
</head>

<body>

</body>
<script>
    function test() { //同步函数

    }
    function test1() { //异步函数
        return new Promise()

    }
    //  async写在函数前，表示该函数内部有异步操作，返回值是promise对象
    async function demo() {
        return new Promise((resolve, reject) => {
            resolve('hello world')
        })
    }

    async function demo2() { //实现异步函数
        return 'hello world'
    }
    console.log(demo2())
</script>

</html>